package service.impl;

import dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pojo.User;
import service.UserService;

import java.util.List;

@Service("userService")
public class UserServiceImpl implements UserDao, UserService {
    @Autowired
   private UserDao userDao ;

    @Override
    public int addUser(User user) {
        return userDao.addUser(user);
    }

    @Override
    public List<User> findAll(User user, int offset, int pageSize) {
        return userDao.findAll(user.getName(), user.getPass(), offset, pageSize);
    }


    @Override
    public List<User> findAll(String name, String pass, int offset, int pageSize) {
        return userDao.findAll(name, pass, offset, pageSize);
    }

    @Override
    public int count(User user) {
        return 0;
    }

    /*@Override
    public List<User> findAll() {
        return userDao.findAll();
    }*/
    @Override
    public User findById(Integer id) {
        return userDao.findById(id);
    }

    @Override
    public int updateUser(User user) {
        return userDao.updateUser(user);
    }

    @Override
    public int deleteUserById(Integer id) {
        return userDao.deleteUserById(id);
    }
}
